const {
	SuccessModel
} = require("../model/responseModel.js");
const {
	getList
} = require("../controllers/blog.js");
const handleBlogRoute = (req, res) => {
	const method = req.method;

	if (method === "GET" && req.path === "/api/blog/list") {
		const author = req.query.author || "";
		const keyworld = req.query.keyworld || "";
		const listData = getList(author, keyworld);
		return new SuccessModel(listData)
	}
	if (method === "GET" && req.path === "/api/blog/detail") {
		return {
			message: "获取博客详情"
		}
	}
	if (method === "POST" && req.path === "/api/blog/new") {
		return {
			message: "新增博客"
		}
	}
	if (method === "POST" && req.path === "/api/blog/updata") {
		return {
			message: "更新博客"
		}
	}
	if (method === "POST" && req.path === "/api/blog/delete") {
		return {
			message: "删除博客"
		}
	}
	return false
};
module.exports = handleBlogRoute
